home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 001-025 / disk_008 / src / hack.wield.c < prev    next >
C/C++ Source or Header  |  1992-05-06  |  2KB  |  93 lines

  1. /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
  2. /* hack.wield.c version 1.0.1 - evaporate%s */
  3.  
  4. #include    "hack.h"
  5.  
  6. setuwep(obj) register struct obj *obj; {
  7.     setworn(obj, W_WEP);
  8. }
  9.  
  10. dowield()
  11. {
  12.     register struct obj *wep;
  13.     register int res = 0;
  14.  
  15.     multi = 0;
  16.     if(!(wep = getobj("#-)", "wield"))) /* nothing */;
  17.     else if(uwep == wep)
  18.         pline("You are already wielding that!");
  19.     else if(uwep && uwep->cursed)
  20.         pline("The %s welded to your hand!",
  21.             aobjnam(uwep, "are"));
  22.     else if((int) wep == 1) {
  23.         if(uwep == 0){
  24.             pline("You are already empty handed.");
  25.         } else {
  26.             setuwep((struct obj *) 0);
  27.             res++;
  28.             pline("You are empty handed.");
  29.         }
  30.     } else if(uarms && wep->otyp == TWO_HANDED_SWORD)
  31.     pline("You cannot wield a two-handed sword and wear a shield.");
  32.     else if(wep->owornmask & (W_ARMOR | W_RING))
  33.         pline("You cannot wield that!");
  34.     else {
  35.         setuwep(wep);
  36.         res++;
  37.         if(uwep->cursed) pline("The %s itself to your hand!",
  38.             aobjnam(uwep, "weld"));
  39.         else prinv(uwep);
  40.     }
  41.     return(res);
  42. }
  43.  
  44. corrode_weapon(){
  45.     if(!uwep || uwep->olet != WEAPON_SYM) return;    /* %% */
  46.     if(uwep->rustfree)
  47.         pline("Your %s not affected.", aobjnam(uwep, "are"));
  48.     else {
  49.         pline("Your %s!", aobjnam(uwep, "corrode"));
  50.         uwep->spe--;
  51.     }
  52. }
  53.  
  54. chwepon(otmp,amount)
  55. register struct obj *otmp;
  56. register int amount;
  57. {
  58. register char *color = (amount < 0) ? "black" : "green";
  59. register char *time;
  60.     if(!uwep || uwep->olet != WEAPON_SYM) {
  61.         strange_feeling(otmp);
  62.         return(0);
  63.     }
  64.  
  65.     if(uwep->otyp == WORM_TOOTH && amount > 0) {
  66.         uwep->otyp = CRYSKNIFE;
  67.         pline("Your weapon seems sharper now.");
  68.         uwep->cursed = 0;
  69.         return(1);
  70.     }
  71.  
  72.     if(uwep->otyp == CRYSKNIFE && amount < 0) {
  73.         uwep->otyp = WORM_TOOTH;
  74.         pline("Your weapon looks duller now.");
  75.         return(1);
  76.     }
  77.  
  78.     /* there is a (soft) upper limit to uwep->spe */
  79.     if(amount > 0 && uwep->spe > 5 && rn2(3)) {
  80.         pline("Your %s violently green for a while and then evaporate%s.",
  81.         aobjnam(uwep, "glow"), (uwep->quan == 1) ? "s" : "");
  82.         useup(uwep);
  83.         return(1);
  84.     }
  85.     if(!rn2(6)) amount *= 2;
  86.     time = (amount*amount == 1) ? "moment" : "while";
  87.     pline("Your %s %s for a %s.",
  88.         aobjnam(uwep, "glow"), color, time);
  89.     uwep->spe += amount;
  90.     if(amount > 0) uwep->cursed = 0;
  91.     return(1);
  92. }
  93.